package com.scut.fy.admin.flux.service;

import com.scut.fy.admin.flux.model.entity.SysUser;
import com.scut.fy.admin.flux.repository.SysUserRepository;
import com.scut.fy.common.web.util.SnowflakeIdGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

/**
 * TODO
 *
 * @author JY
 * @version 1.0
 * @date 2021/10/14
 */
@Service
public class SysUserService {

    private static final Logger logger = LoggerFactory.getLogger(SysUserService.class);

    @Autowired
    private SysUserRepository sysUserRepository;

    @Resource
    private SnowflakeIdGenerator snowflakeIdGenerator;

    public Mono<SysUser> save (SysUser user) {
        user.setId(snowflakeIdGenerator.getId());
        return sysUserRepository.save(user);
    }


}
